package com.zrq.secondkill.service;

import com.zrq.secondkill.error.BusinessException;

public interface  OrderService {

    /**
     * 校验订单信息,尝试扣减redis库存,并写stockLog
     * TODO(zrq): 此方法已演变为内部实现,不应暴露
     *
     * @param userId
     * @param itemId
     * @param amount
     * @param promoId
     * @param stockLogId
     * @throws BusinessException
     */
    void decreaseRedisStockAndWriteStockLog(Integer userId, Integer itemId, Integer amount, Integer promoId, String stockLogId) throws BusinessException;

    /**
     * @param userId
     * @param itemId
     * @param amount
     * @param promoId
     * @return 创建订单是否成功
     */
    Boolean asyncCreateOrder(Integer userId, Integer itemId, Integer amount, Integer promoId);
}

